package decorator.files;

import java.io.*;

public class Text {	
	private String url;
	
	public Text(String url){
		this.url = url;
	}
	public String dir(){		
		return Text.class.getResource("").getPath() + url;
	}
	
	public void view(){
		BufferedReader br=null;
		String txt=null;
		int cnt=0;
		try{
			File f = new File(dir());
			br=new BufferedReader(new InputStreamReader(new FileInputStream(f)));
			while((txt=br.readLine())!=null){
				
				System.out.println(++cnt +" "+txt);
			}
		}catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
		}finally{
			if(br != null)
				try {
					br.close();
				} catch (IOException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
		}
		
	}
	

	

}
